package cn.lsc._01_sync;


import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.Message;

import java.nio.charset.StandardCharsets;

public class Producer1 {
    public static void main(String[] args) throws Exception {//

        //1 实例化生产者对象
        DefaultMQProducer producer = new DefaultMQProducer("sync_producer_group");
        producer.setNamesrvAddr("localhost:9876");
        //启动
        producer.start();
        Message message = new Message("sync","shit","我在源码摸鱼！".getBytes(StandardCharsets.UTF_8));
        SendResult send = producer.send(message);
        System.out.println(send);
        producer.shutdown();
    }
}
